package priv.mill.config;

import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;

import javax.annotation.Resource;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class String2DateConvertor implements Converter<String, Date> {

	@Resource
	private DateFormat format;

	@Override
	public Date convert(String arg0) {
		
//		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		try {
			return format.parse(arg0);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return null;
	}

}
